import KoaRouter from 'koa-router'
export const loginRoute=new KoaRouter()
import {LoginController} from '../controllers/login'



loginRoute.get('/login',async(ctx)=>{
  console.log("login路由接收到get请求");
  // 直接从请求的query对象中获取参数,query对象是解析查询字符串后生成的,而querystring是请求的字符串
  const payload=ctx.request.query
  console.log(ctx.request.querystring);
  console.log("接收到参数",payload);
  const validateRes =await new LoginController().validateUser(payload) 
  console.log("登录结果",validateRes);
  ctx.body={
    validateRes,
    message:'ok'
  }
})
